/**
 * @param {number} n
 * @return {number}
 */
var fib = function(n) {
    let pre = 0,now = 1,res
    for(let i = 2; i < n + 1; i++){      
        res = pre + now
        pre = now
        now = res
    }
    if(n < 2){
        res = n
    }
    return res
};